<?php

  require_once "JooS/PHPackager/FS/Action/Interface.php";
  
 /**
  * @package JooS
  * @subpackage PHPackager
  */

  abstract class JooS_PHPackager_FS_Action_Abstract implements JooS_PHPackager_FS_Action_Interface {
    /**
     * @var array
     */
    private $_data;

    /**
     * @param string $name
     * @return bool
     */
    public function __isset($name) {
      $name = $this->_normalizeName($name);
      return isset($this->_data[$name]);
    }

    /**
     * @param string $name
     * @return mixed
     */
    public function __get($name) {
      $name = $this->_normalizeName($name);
      return isset($this->_data[$name]) ? $this->_data[$name] : null;
    }

    /**
     * @param string $name
     * @param mixed $value
     */
    public function  __set($name, $value) {
      $name = $this->_normalizeName($name);
      $this->_data[$name] = $value;
    }

    /**
     * @param string $name
     */
    public function __unset($name) {
      $name = $this->_normalizeName($name);
      if (isset($this->_data[$name])) {
        unset($this->_data[$name]);
      }
    }

    protected function  __construct() {
      $this->_data = array();
    }

    /**
     *
     * @param string $name
     * @return string
     */
    private function _normalizeName($name) {
      return strtolower($name);
    }
  }
